#ifndef PREF_CHANNELLIST_H_
#define PREF_CHANNELLIST_H_

#include "../widgets.h"
#include "../channellist.h"
#include "p_widgets.h"

namespace gpyp {
namespace pref {

class ColumnList : public ListView<ChannelList> {
  friend class PrefChannelList;
private:
  Gtk::CellRendererToggle   renderer_enable_;
  Gtk::CellRendererText     renderer_title_;
  Gtk::CellRendererText     renderer_format_;
  Gtk::CellRendererToggle   renderer_right_;
  Gtk::CellRendererToggle   renderer_sortasc_;
  Gtk::CellRendererToggle   renderer_expand_;
  Gtk::CellRendererToggle   renderer_ellipsize_;

  Gtk::TreeViewColumn       column_enable_;
  Gtk::TreeViewColumn       column_title_;
  Gtk::TreeViewColumn       column_format_;
  Gtk::TreeViewColumn       column_right_;
  Gtk::TreeViewColumn       column_sortasc_;
  Gtk::TreeViewColumn       column_expand_;
  Gtk::TreeViewColumn       column_ellipsize_;

  void enable_on_cell_data(Gtk::CellRenderer *cell, const Gtk::TreeIter &iter);
  void title_on_cell_data(Gtk::CellRenderer *cell, const Gtk::TreeIter &iter);
  void format_on_cell_data(Gtk::CellRenderer *cell, const Gtk::TreeIter &iter);
  void right_on_cell_data(Gtk::CellRenderer *cell, const Gtk::TreeIter &iter);
  void sortasc_on_cell_data(Gtk::CellRenderer *cell, const Gtk::TreeIter &iter);
  void expand_on_cell_data(Gtk::CellRenderer *cell, const Gtk::TreeIter &iter);
  void ellipsize_on_cell_data(Gtk::CellRenderer *cell, const Gtk::TreeIter &iter);

  void enable_on_toggled(const Glib::ustring &path);
  void title_on_edited(const Glib::ustring &path, const Glib::ustring &new_text);
  void format_on_edited(const Glib::ustring &path, const Glib::ustring &new_text);
  void right_on_toggled(const Glib::ustring &path);
  void sortasc_on_toggled(const Glib::ustring &path);
  void expand_on_toggled(const Glib::ustring &path);
  void ellipsize_on_toggled(const Glib::ustring &path);

public:
  ColumnList(Application &app, Gtk::Window &parent);
};

class ChannelList : public Gtk::VBox {
private:
  Application    &app_;

  Gtk::SpinButton sort_color_;
  ColumnList      list_;

public:
  ChannelList(Application &app, Gtk::Window &parent);
};

}/*pref*/
}/*gpyp*/

#endif/*PREF_CHANNELLIST_H_*/
